<?php
namespace app\common\library\util;

use dh2y\qrcode\QRcode;

class QRcodeUtil{
    public static function createQRcode($link,$avatar_text){
        $avatarPath = ROOT_PATH.'public'.$avatar_text;
        //二维码容错率
        $level = ['L', 'M'];
        $index = array_rand($level);

        $qrcode = new QRcode();
        $qrcodePath =  $qrcode->png($link,false,13,$level[$index])
                        ->logo($avatarPath)
                        ->getPath();
        return $qrcodePath;
    }
}